<link href="/layer/skin/layer.css" rel="stylesheet">
<script src="layer/layer.js"></script>

<div class="form-group">
    <label class="col-xs-3 control-label">企业名称：</label>

    <div class="col-xs-9">
        <input type="hidden" name="id" value="${company.id!}"/>
        <input name="companyName" minlength="2" value="${company.companyName!}" type="text" class="form-control"
               required>
    </div>
</div>
<div class="form-group">
    <label class="col-xs-3 control-label">企业类型：</label>

    <div class="col-xs-9">
        <select name="companyType" value="${company.companyType!}" class="form-control">
            <option value="1">银行</option>
            <option value="2">4S店</option>
            <option value="3">保险公司</option>
            <option value="4">修理厂</option>
            <option value="5">汽配厂商</option>
            <option value="6">其他</option>
        </select>

    </div>
</div>
<div class="form-group">
    <label class="col-xs-3 control-label">区域：</label>

    <div class="col-xs-9">
        <select id="organizationId" name="organizationId"  class="form-control" value="${company.organizationId!}">
            <option value=""></option>
        </select>
        <script type="text/javascript">
            $(function () {
                $.getJSON("company/queryOrganization", function (list) {
                    var parent;
                    for (var i = 0; i < list.length; i++) {
                        row = list[i];
                        var organizationId = row.organizationId;
                        if(organizationId == 0) {
                            continue;
                        }
                        if (row.parentOrganizationId == 0) {
                            parent = $("<optgroup>").attr("label",row.name);
                            $("#organizationId").append(parent);
                        } else {
                            var option = $("<option>").val(row.organizationId).text(row.name);
                            parent.append(option)
                        }
                    }
                    $("#organizationId").val($("#organizationId").attr("value"));
                });
            });
        </script>
    </div>
</div>
<div class="form-group">
    <label class="col-xs-3 control-label">地址：</label>

    <div class="col-xs-9">
        <input class="form-control" name="address" value="${company.address!}" required>
    </div>
</div>

<div class="form-group">
    <label class="col-xs-3 control-label">联系人1：</label>

    <div class="col-xs-9">
        <input class="form-control" name="contactPerson1Name" value="${company.contactPerson1Name!}"  required>
    </div>
</div>

<div class="form-group">
    <label class="col-xs-3 control-label">职位：</label>

    <div class="col-xs-9">
        <input class="form-control" name="contactPerson1Position" value="${company.contactPerson1Position!}"  required>
    </div>
</div>

<div class="form-group">
    <label class="col-xs-3 control-label">电话：</label>

    <div class="col-xs-9">
        <input class="form-control" name="contactPerson1Phone" value="${company.contactPerson1Phone!}"  required="true" number="true" minlength="6">
    </div>
</div>

<div class="form-group">
    <label class="col-xs-3 control-label">联系人2：</label>

    <div class="col-xs-9">
        <input class="form-control" name="contactPerson2Name" value="${company.contactPerson2Name!}">
    </div>
</div>

<div class="form-group">
    <label class="col-xs-3 control-label">职位：</label>

    <div class="col-xs-9">
        <input class="form-control" name="contactPerson2Position" value="${company.contactPerson2Position!}">
    </div>
</div>

<div class="form-group">
    <label class="col-xs-3 control-label">电话：</label>

    <div class="col-xs-9">
        <input class="form-control" name="contactPerson2Phone" value="${company.contactPerson2Phone!}" number="true" minlength="6">
    </div>
</div>